import router from "."
import { Local } from "@/utils/storage"
import { useSettingStore } from "../stores/setting"

router.beforeEach((to, from, next) => {
    const userInfo=Local.get('userInfo')
    const settingStore = useSettingStore();
    if (userInfo === null&&to.path!=='/login') {
        /* has token*/
       
        router.push({ path: '/login' });
       
    } else if (userInfo !== null) {
        settingStore.setTitle(to.meta.title);
        next()
    }else {
        next()
    }

})